home *** CD-ROM | disk | FTP | other *** search
- vc.lib - C library for the Amiga68k version of vbcc
-
-
- INTRODUCTION
-
- vc.lib shall be an ANSI compliant C library for use with the
- Amiga68k version of vbcc.
-
- It is written largely in C and some parts are not Amiga specific.
-
- At the moment only a part of the ANSI functions and includes is
- there and many functions may not be ANSI compliant yet. It should
- however contain the most frequently used functions and all those
- that are used by vbcc itself.
- You can also create a small data library (this one will probably
- be in the archive already as vcs.lib), a small-code-version, a
- 020-version etc. or combinations of this (see COMPILING).
-
- Note that You have to link with a math library if You want to use
- floating point. All math functions, special startup code and
- printf/scanf functions which support floating point are contained in
- the math libraries only.
- At the moment There are two math libraries:
-
- mieee.lib This one uses the C= math libraries. The startup code
- will always open MathIeeeSingBas.library,
- MathIeeeDoubBas.library and MathIeeeDoubTrans.library.
- Float return values are passed in d0, double return
- values are passed via pointers.
- A 68000 is sufficient to use this library.
- You must not specify -fpu=... when You use this library.
-
- m881.lib This one uses direct FPU instructions and function
- return values are passed in fp0. You must have a
- 68020 or higher and a FPU to use this library. You
- also have to specify -fpu=68881.
- Several FPU instructions that have to be emulated on
- 040/060 may be used.
- (a math library for 040/060 might be done in the future)
-
- To link with one of those libraries add e.g. the -lmieee option to vc or
- specify mieee.lib before vc.lib if You do the linking by hand.
-
- Some info about amiga.lib can be found in fd2lib.doc.
-
-
- LEGAL
-
- vc.lib is public domain. Certain parts have been taken from other
- PD libraries (mainly libnix).
- The same applies to m881.lib and mieee.lib.
-
-
- STARTUP etc.
-
- The startup code currently consists of a slightly modified standard
- Amiga startup and the file _main.c. The startup code sets up some
- global variables and initializes stdin, stdout and stderr.
- The exit code closes all open files and frees all memory.
- If You link with a math library the startup/exit code will be taken
- from there if necessary.
-
-
- STDIO
-
- Most of the functions for buffered IO are implemented. The number of
- open files is unlimited and they are handled with a linked list.
- So You can not expect the arrays like used in most Unix compilers.
- The non-ANSI functions like open(), read() etc. are not supported
- either at the moment.
-
- The following functions are implemented at the moment:
-
- fopen() binary and text modes are the same, ttys are unbuffered;
- line buffering is not possible at the moment
- fclose()
- fflush()
- fgetc()
- ungetc()
- fputc()
- fgets()
- fputs()
- fread()
- fwrite()
- gets() never use it...
- puts()
- ftell()
- fseek()
- remove()
- rename()
- rewind()
- setvbuf()
- setbuf()
- feof()
- ferror()
- prerror()
- tmpnam()
- tmpfile() always returns an error at the moment
- fgetpos()
- fsetpos()
- printf() taken from libnix; link with a math library if You need fp
- fprintf() "
- sprintf() "
- vprintf() "
- vfprintf() "
- vsprintf() "
- scanf() "
- fscanf() "
- sscanf() "
-
-
- STDLIB
-
- The following functions do exist.
-
- malloc() uses a variation of the example in K&R;
- currently allocates chunks of at least _nalloc*8 bytes;
- You can set _nalloc after an extern size_t _nalloc;
- free()
- calloc()
- rand() taken from libnix
- srand() "
- system() uses SystemTagList or Execute depending on OS version
- abs()
- labs()
- div() uses normal division; is this ok?
- ldiv() "
- abort()
- atexit()
- getenv() taken from libnix
- qsort() "
- bsearch() "
- strtol() "
- strtoul() "
- atol() "
- atoi() "
- atof() taken from libnix; link with a math library to use this
- strtod() "
-
-
- TIME
-
- Most standard functions should exist. Taken from libnix.
- Link with a math library if You use difftime().
-
-
- STRING
-
- Most standard functions should exist.
-
-
- CTYPE
-
- Most standard functions should exist.
-
-
- LIMITS
-
- Taken from another library, but at least the standard integer limits
- should be ok. No functions.
-
-
- FLOAT
-
- I do not know what has to be there, yet, but the most important things
- should be there (and approximately correct). No functions.
-
-
- MATH
-
- You have to link with a math library to use these functions.
- The following functions should be there, but they may be not precise
- enough or otherwise not fully ANSI conform (e.g. errno is not set and
- pow() with m881 is probably not good enough):
-
- sin(), cos(), tan()
- sinh(), cosh(), tanh()
- asin(), acos(), atan(), atan2()
- exp(), log(), log10(), pow()
- ceil(), floor()
- sqrt()
- fabs()
- fmod()
-
-
- STDDEF
-
- Currently defines size_t, fpos_t, ptrdiff_t, wchar_t, time_t, clock_t,
- NULL and offsetof. No functions.
-
-
- STDARG
-
- Defines va_list, va_start, va_arg and va_end. Seems to work well, but
- vbcc gives an 'offset equals size of object' warning. No functions.
-
-
- ASSERT
-
- Not really tested yet. No functions.
-
-
- ERRNO
-
- The include file and errno is there, but most functions do not set
- errno. No functions.
-
-
- SETJMP
-
- Oh well...I only wrote down some lines, but I doubt this really works.
- Also I think there should be a special version for fpu.
-
-
- SIGNAL
-
- signal() and raise() are there, but always return an error.
-
-
- Again, there may be lots of errors or missing things in the include files
- and the library.
-
-
- COMPILING
-
- If You want to compile the libraries Yourself You should be able
- to call the Make#?.script scripts from their directory and the rest
- should be done automatically and the resulting .lib file will be
- copied to vlib: (so take care You do not overwrite another library).
- If You want to create special libraries (e.g. a vc.lib for 020+)
- You have to edit the Make scripts.
- E.g. to create the small-data-vcs.lib change add -sd in the
- alias cc ... line and replace every following vc by vcs.
-
- Currently there is no small-data-version of the math libraries (it
- should not make a difference with m881.lib, but with mieee.lib).
-
- Note however that You probably have to link with PhxLnk to use small data
- or small code models and that You have to compile Your objects with
- small data, too.
-
-
-
-
- Volker volker@vb.franken.de
-
-